import {Component, OnInit, ViewChild} from '@angular/core';
import {ModalDirective, TabsetComponent} from "ngx-bootstrap";
import { Router} from "@angular/router";
import {Location} from '@angular/common';
import {FormControl, FormGroup} from "@angular/forms";
import {animate, state, style, transition, trigger} from "@angular/animations";
import * as echarts from 'echarts';

@Component({
  selector: 'app-pages',
  templateUrl: './pages.component.html',
  styleUrls: ['./pages.component.css'],
  animations:[trigger('navIn',[
    state('in',style({
      'margin-top':'50px'
    })),
    state('out',style({
      'margin-top':0
    })),
    transition('in => out',animate('300ms ease-in')),
    transition('out => in',animate('300ms ease-out'))
  ])]
})
export class PagesComponent implements OnInit {
  @ViewChild('projectTabs') projectTabs: TabsetComponent;
  @ViewChild('childModal') public childModal:ModalDirective;
  public passwordForm: FormGroup;

  inNav:string='in'


  changeNav(){
    this.inNav==='in'?this.inNav='out':this.inNav='in'
  }

  constructor(
    private router:Router,
    private location:Location,
    // private authService:AuthService,
    // private userService:UserService
  ) {

  }
  public userName:string

  // private storage:sessionStorage

  // public tabls:any=[]
  ngOnInit() {
    this.passwordForm = new FormGroup({
      password_old: new FormControl(),
      password_new: new FormControl(),
      password_again: new FormControl(),
    });
  }

  changePwd():void {
    console.debug(this.childModal)
    this.childModal.show();
  }

  hideChildModal():void {
    this.childModal.hide();
  }

  private tabName:string='综合展示'

  test(name:any){
    this.tabName=name
  }

}
